<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>随手快递</title>
		<link rel="stylesheet" type="text/css" href="../../AUI/css/aui.css" />
		<link rel="stylesheet" type="text/css" href="../../font-awesome/css/font-awesome.min.css" />
		<style type="text/css">
		.st-v{
			border: 1px solid rgba(214, 228, 167, 0.58);
			background: rgba(214, 228, 167, 0.58);
			border-radius: 10px;
			margin: 0px 15px 15px 15px;
		}
		.st-m{
			border-left:2px dotted #bfcb94;
			height: 100%;
			padding:16px 0 0 0px;
			width: 40px;
			text-align: center;
		}
			.aui-padded-15{
				padding-right: 10px !important;
			}
		.z_mask {
			width: 100%;
			height: 100%;
			background: rgba(0, 0, 0, .5);
			position: fixed;
			top: 0;
			left: 0;
			z-index: 999;
			display: none;
		}

		.z_alert {
			width:70%;
			height: 100px;
			border-radius: .2rem;
			background: #fff;
			font-size:15px;
			text-align: center;
			position: absolute;
			left: 50%;
			top: 50%;
			transform: translate(-50%, -50%);
		}
		.z_alert p:nth-child(1) {
			line-height: 70px;
		}

		.z_alert p:nth-child(2) span {
			display: inline-block;
			width: 49%;
			height: 28px;
			line-height: 28px;
			float: left;
			border-top: 1px solid #ddd;
		}

		.z_sure {
			border-right: 1px solid #ddd;
		}
		</style>
	</head>
	<body style="overflow-x: hidden">
	<div class="z_mask" id="m1">
		<!--弹出框-->
		<div class="z_alert">
			<span style="line-height: 66px"><div style="margin-top: 5px;" id="name"></div></span>
			<p>
				<span class="z_sure" id="s1">确认</span>
				<span class="z_cancel">取消</span>
			</p>
		</div>
	</div>
		<header class="aui-bar aui-bar-nav" id="aui-header">
			<a class="aui-btn aui-pull-left" tapmode onclick="history.back();">
				<span class="aui-iconfont aui-icon-left"></span>
			</a>
			<div class="aui-title">积分商城</div>
			<div class="aui-btn aui-pull-right"></div>
		</header>
		<section class="aui-content-padded">
			<div class="aui-card-list">
				<div class="aui-card-list-header"></div>
				<div class="aui-card-list-content-padded " style="height: 80px">
					<img  id="headPortraitUrl" class="aui-img-round" style="width:65px;margin: -10px 0 0 10px;float: left">
					<div style="float: left;margin-left:20px;font-size: 16px" id="nickname"></div>
					<div style="float: right;margin-top:10px;font-size: 18px;color: #0a628f" id="integralScore"></div>
					</div>
			</div>
		</section>
		<div class="aui-content">
			<div id="voucher" class="aui-content" style="background: rgba(253, 253, 253, 0.95);padding: 15px 0 1px 0">
			</div>
		</div>
		<script src="../../myJs/jquery.js"></script>
	<script type="text/javascript" src="../../myJs/index.js" ></script>
		<script>
			var data={
				"code": 95158,
				"user": {
					"headPortraitUrl": "../../myImage/5.png",
					"nickname": "summery",
					"sex": "4Bm1fd6WR3",
					"signature": "T9C7AHeh3A",
					"integralScore": 10,
					"creditScore": 93969
				},
				"msg": [
					{
						"vouchersId": 1,
						"vouchersName": "抵用券-新用户专享",
						"vouchersFailuretime": "有效期至2017-8-30",
						"vouchersPrice": "10",
						"vouchersScore": 0
					},
					{
						"vouchersId": 2,
						"vouchersName": "抵用券-通用",
						"vouchersFailuretime": "有效期至2017-8-30",
						"vouchersPrice": "5",
						"vouchersScore": 120
					},
					{
						"vouchersId": 4,
						"vouchersName": "抵用券-暑期专享",
						"vouchersFailuretime": "有效期至2017-8-30",
						"vouchersPrice": "7",
						"vouchersScore": 180
					},{
						"vouchersId": 4,
						"vouchersName": "抵用券-积分乐享",
						"vouchersFailuretime": "有效期至2017-8-30",
						"vouchersPrice": "10",
						"vouchersScore": 300
					},{
						"vouchersId": 5,
						"vouchersName": "抵用券-老用户专享",
						"vouchersFailuretime": "有效期至2017-8-30",
						"vouchersPrice": "5",
						"vouchersScore": 100
					}
				]
			}

			$(function() {
				/*  $.ajax({
				 type: "post",
				 url: '/randomdelivery/userWalletManageController/exchangeVouchersStore',
				 data: { },
				 datatype: "json",
				 success: function (data) {

				 }
				 });*/
				viewVoucher(data);
			})

			function viewVoucher(data){
				$("#nickname").html(data.user.nickname);
				$("#headPortraitUrl").attr("src",data.user.headPortraitUrl);
				$("#integralScore").html("积分："+data.user.integralScore);
				$.each(data.msg,function(num,data){
					$("#voucher").append('	<div class="aui-list st-v" onclick="change(this)" vouchersName="'+data.vouchersName+'" vouchersId="'+data.vouchersId+'">\
							<div class="aui-list-item">\
							<div class="aui-list-item-inner aui-padded-15">\
							<div class="aui-list-item-title"><h3 class="aui-padded-b-5">'+data.vouchersName+'\
							<span style="font-size: 11px;color: #0a628f">【'+data.vouchersScore+'积分】</span></h3>\
					<small style="color: #626262">'+data.vouchersFailuretime+'</small></div>\
							<div class="st-m"><span>￥'+data.vouchersPrice+'</span></div>\
							</div>\
							</div>\
							</div>');
				})

			}

			function change(node){
				var vouchersId = node.getAttribute("vouchersId");
				sessionStorage.setItem("vouchersId",vouchersId);
				var vouchersName = node.getAttribute("vouchersName");
				$("#name").html("确认兑换 "+vouchersName+"?");
				//alert(vouchersId);
				$("#m1").show();
			}
			$("#s1").on("click",function(){
				var vouchersId = sessionStorage.getItem("vouchersId");
				/*  $.ajax({
				 type: "post",
				 url: '/randomdelivery/userWalletManageController/exchangeVouchers',
				 data: {
				 "vouchersId":vouchersId
				 },
				 datatype: "json",
				 success: function (data) {

				 }
				 });*/
				//alertmd("兑换成功，请在我的代金券内查看");
				alertmd("积分不足，兑换失败");
				$("#m1").hide();
			})
			$(".z_cancel").on("click",function(){
				var status = $("#statusBtn").html();
				$(".z_mask").hide();

			})
		</script>

	</body>
</html>